<template>
 <div>
   <van-field
   :label ="label"
   :type="type"
   :placeholder="placeholder"
   :rule="rule"
   v-model="content"
   />
 </div>
</template>

<script>
export default {
  data () {
    return {
content: ''
    }
  },
props:['label','type','placeholder','rule'],
methods: {
 handleChange () {
   const rul  = new RegExp(this.rule)
   if(rul.test(this.content)) {
    this.$emit('inputChange',this.content)
   }
 }
},
watch:{
  content () {
    this.handleChange()
  }
}
}
</script>

<style lang="less">

</style>
